<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link rel="manifest" href="manifest.json">

    <!-- un-comment this code to enable service worker
    <script>
      if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }
    </script>-->

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>
    <script src="lib/vconsole.min.js"></script>
    <script type="text/javascript">
        var vConsole = new VConsole();
    </script>

    <!-- your app's js -->
    <script src="js/array.polyfill.js"></script>
    <script src="js/string.polyfill.js"></script>
    <script src="js/app.js"></script>
    <script src="js/ble-service.js"></script>
</head>

<body ng-app="starter">

    <ion-pane ng-controller="TestController">
        <ion-header-bar class="bar-stable">
            <h1 class="title">Ionic Blank Starter</h1>
        </ion-header-bar>
        <ion-content class="has-footer">
            <ion-list>
                <ion-item ng-repeat="item in devices" class="item-button-right">
                    <h2 ng-bind="item.id"></h2>
                    <span ng-bind="item.name"></span>
                    <span ng-bind="item.rssi"></span>dBm
                    <span ng-show="item.power">{{item.power}}%</span>
                    <button class="button button-positive" ng-click="connect(item)" ng-hide="item.connected"> 连接
                    </button>
                    <button class="button button-dark" ng-click="disconnect(item)" ng-hide="!item.connected"> 断开
                    </button>
                    <ion-list class="list-inset" ng-show="item.connected">
                        <ion-item>
                            温度 <span ng-show="item.temperature">{{item.temperature}}
                                &#8451;</span>
                            <button class="button button-positive button-small" ng-click="startReadTemperature(item)"
                                ng-show="item.connected && !item.reading">
                                开始采集温度
                            </button>
                        </ion-item>
                        <ion-item>
                            转速 <span ng-show="item.revolution">{{item.revolution}} rpm</span>
                            <button class="button button-positive button-small" ng-click="startReadRevolution(item)"
                                ng-show="item.connected && !item.reading">
                                开始采集转速
                            </button>
                        </ion-item>
                        <ion-item>
                            加速度 <span ng-show="item.acceleration">{{item.acceleration}} m/s&sup2;</span>
                            <button class="button button-positive button-small" ng-click="startReadAcceleration(item)"
                                ng-show="item.connected && !item.reading">
                                开始采集转速
                            </button>
                        </ion-item>
                        <ion-item>
                            速度 <span ng-show="item.speed">{{item.speed}} mm/s</span>
                            <button class="button button-positive button-small" ng-click="startReadSpeed(item)"
                                ng-show="item.connected && !item.reading">
                                开始采集速度
                            </button>
                        </ion-item>
                        <ion-item>
                            位移 <span ng-show="item.displacement">{{item.displacement}} &mu;m</span>
                            <button class="button button-positive button-small" ng-click="startReadDisplacement(item)"
                                ng-show="item.connected && !item.reading">
                                开始采集位移
                            </button>
                        </ion-item>
                        <ion-item ng-show="item.connected && item.reading">
                            <button class="button button-dark button-small" ng-click="stopRead(item)"> 停止采集
                            </button>
                        </ion-item>
                    </ion-list>
                </ion-item>
                <ion-item ng-show="error" ng-bind="error"></ion-item>
            </ion-list>
        </ion-content>
        <div class="bar bar-footer">
            <button class="button button-positive button-small" ng-click="scan()"> 扫描 </button>
        </div>
    </ion-pane>
</body>

</html>